package utils;

import java.util.HashMap;
import java.util.Map;

public class MapUtil {
    public static <K, V> Map<K, V> mapString2Map(String s) {
        String str = s.substring(1, s.length() - 1);
        String[] strs = str.split(",");
        Map<K, V> map = new HashMap<>();
        for (String string : strs) {
            K key = (K) string.split("=")[0].trim();
            V value = (V) string.split("=")[1].trim();
            map.put(key, value);
        }
        return map;
    }
}
